package datarunner

import (
	"time"
)

type options struct {
	hour, min, sec int
	of     bool
	timer  time.Duration
	tf     bool
}

// Option overrides behavior of Connect.
type Option interface {
	apply(*options)
}

type optionFunc func(*options)

func (f optionFunc) apply(o *options) {
	f(o)
}

//定时器更新
func WithTriggerTimer(t time.Duration) Option {
	return optionFunc(func(o *options) {
		o.timer = t
		o.tf = true
	})
}

//每天固定时间更新
func WithTriggerDaily(hour, min, second int) Option {
	return optionFunc(func(o *options) {
		o.hour = hour
		o.min = min
		o.sec = second
		o.of = true
	})
}
